home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / RIncludes / ConditionalMacros.r < prev    next >
Encoding:
Text File  |  2000-04-12  |  11.1 KB  |  324 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        ConditionalMacros.r
  3.  
  4.      Contains:    Set up for compiler independent conditionals
  5.  
  6.      Version:    Technology:    Universal Interface Files 3.3
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    © 1993-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17.  
  18. #ifndef __CONDITIONALMACROS_R__
  19. #define __CONDITIONALMACROS_R__
  20.  
  21. /****************************************************************************************************
  22.     UNIVERSAL_INTERFACES_VERSION
  23.     
  24.         0x0330 => version 3.3
  25.         0x0320 => version 3.2
  26.         0x0310 => version 3.1
  27.         0x0301 => version 3.0.1
  28.         0x0300 => version 3.0
  29.         0x0210 => version 2.1
  30.         This conditional did not exist prior to version 2.1
  31. ****************************************************************************************************/
  32. #define UNIVERSAL_INTERFACES_VERSION 0x0330
  33.  
  34. /****************************************************************************************************
  35.  
  36.     TARGET_CPU_≈    
  37.     These conditionals specify which microprocessor instruction set is being
  38.     generated.  At most one of these is true, the rest are false.
  39.  
  40.         TARGET_CPU_PPC            - Compiler is generating PowerPC instructions
  41.         TARGET_CPU_68K            - Compiler is generating 680x0 instructions
  42.         TARGET_CPU_X86            - Compiler is generating x86 instructions
  43.         TARGET_CPU_MIPS            - Compiler is generating MIPS instructions
  44.         TARGET_CPU_SPARC        - Compiler is generating Sparc instructions
  45.         TARGET_CPU_ALPHA        - Compiler is generating Dec Alpha instructions
  46.  
  47.  
  48.     TARGET_OS_≈    
  49.     These conditionals specify in which Operating System the generated code will
  50.     run. At most one of the these is true, the rest are false.
  51.  
  52.         TARGET_OS_MAC            - Generate code will run under Mac OS
  53.         TARGET_OS_WIN32            - Generate code will run under 32-bit Windows
  54.         TARGET_OS_UNIX            - Generate code will run under some unix 
  55.  
  56.  
  57.     TARGET_RT_≈    
  58.     These conditionals specify in which runtime the generated code will
  59.     run. This is needed when the OS and CPU support more than one runtime
  60.     (e.g. MacOS on 68K supports CFM68K and Classic 68k).
  61.  
  62.         TARGET_RT_LITTLE_ENDIAN    - Generated code uses little endian format for integers
  63.         TARGET_RT_BIG_ENDIAN    - Generated code uses big endian format for integers     
  64.         TARGET_RT_MAC_CFM        - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
  65.         TARGET_RT_MAC_MACHO     - TARGET_OS_MAC is true and Mach-O style runtime
  66.         TARGET_RT_MAC_68881        - TARGET_OS_MAC is true and 68881 floating point instructions used    
  67.  
  68.  
  69.     TARGET__API_≈_≈    
  70.     These conditionals are used to differentiate between sets of API's on the same
  71.     processor under the same OS.  The first section after _API_ is the OS.  The
  72.     second section is the API set.  Unlike TARGET_OS_ and TARGET_CPU_, these
  73.     conditionals are not mutally exclusive. This file will attempt to auto-configure
  74.     all TARGET_API_≈_≈ values, but will often need a TARGET_API_≈_≈ value predefined
  75.     in order to disambiguate.
  76.     
  77.         TARGET_API_MAC_OS8      - Code is being compiled to run on System 7 through Mac OS 8.x
  78.         TARGET_API_MAC_CARBON   - Code is being compiled to run on Mac OS 8 and Mac OS X via CarbonLib
  79.         TARGET_API_MAC_OSX      - Code is being compiled to run on Mac OS X
  80.  
  81.  
  82.     PRAGMA_≈
  83.     These conditionals specify whether the compiler supports particular #pragma's
  84.     
  85.         PRAGMA_IMPORT             - Compiler supports: #pragma import on/off/reset
  86.         PRAGMA_ONCE              - Compiler supports: #pragma once
  87.         PRAGMA_STRUCT_ALIGN      - Compiler supports: #pragma options align=mac68k/power/reset
  88.         PRAGMA_STRUCT_PACK        - Compiler supports: #pragma pack(n)
  89.         PRAGMA_STRUCT_PACKPUSH    - Compiler supports: #pragma pack(push, n)/pack(pop)
  90.         PRAGMA_ENUM_PACK         - Compiler supports: #pragma options(!pack_enums)
  91.         PRAGMA_ENUM_ALWAYSINT     - Compiler supports: #pragma enumsalwaysint on/off/reset
  92.         PRAGMA_ENUM_OPTIONS        - Compiler supports: #pragma options enum=int/small/reset
  93.  
  94.  
  95.     FOUR_CHAR_CODE
  96.     This conditional does the proper byte swapping to assue that a four character code (e.g. 'TEXT')
  97.     is compiled down to the correct value on all compilers.
  98.  
  99.         FOUR_CHAR_CODE('abcd')    - Convert a four-char-code to the correct 32-bit value
  100.  
  101.  
  102.     TYPE_≈
  103.     These conditionals specify whether the compiler supports particular types.
  104.  
  105.         TYPE_LONGLONG            - Compiler supports "long long" 64-bit integers
  106.         TYPE_BOOL                - Compiler supports "bool"
  107.         TYPE_EXTENDED            - Compiler supports "extended" 80/96 bit floating point
  108.  
  109.  
  110.     FUNCTION_≈
  111.     These conditionals specify whether the compiler supports particular language extensions
  112.     to function prototypes and definitions.
  113.  
  114.         FUNCTION_PASCAL            - Compiler supports "pascal void Foo()"
  115.         FUNCTION_DECLSPEC        - Compiler supports "__declspec(xxx) void Foo()"
  116.         FUNCTION_WIN32CC        - Compiler supports "void __cdecl Foo()" and "void __stdcall Foo()"
  117.  
  118. ****************************************************************************************************/
  119.  
  120.  
  121.  
  122. #define PRAGMA_ONCE    0
  123.  
  124. #if defined(Environ_OS_Win32) || defined(Environ_OS_Unix) || defined(Environ_OS_Mac)
  125.  
  126.     #if Environ_OS_Win32
  127.         /*
  128.             Rez.exe resource compiler for Win32 from QuickTime 3.0, Apple Computer, Inc.    
  129.         */
  130.         #define TARGET_OS_MAC                0
  131.         #define TARGET_OS_WIN32                1
  132.         #define TARGET_OS_UNIX                0
  133.         #define TARGET_RT_LITTLE_ENDIAN        1
  134.         #define TARGET_RT_BIG_ENDIAN        0
  135.  
  136.         #define TARGET_CPU_MIPS                0
  137.         #define TARGET_CPU_SPARC            0
  138.         #define TARGET_CPU_X86                1
  139.         #define TARGET_CPU_PPC                0
  140.  
  141.     
  142.     #elif Environ_OS_Unix
  143.         /*
  144.             Rez resource compiler for unix from QuickTime 3.0, Apple Computer, Inc.    
  145.         */
  146.         #define TARGET_OS_MAC                1
  147.         #define TARGET_OS_WIN32                0
  148.         #define TARGET_OS_UNIX                0
  149.         #define TARGET_RT_LITTLE_ENDIAN        0
  150.         #define TARGET_RT_BIG_ENDIAN        1
  151.  
  152.         #define TARGET_CPU_MIPS                Environ_CPU_MIPS
  153.         #define TARGET_CPU_SPARC            Environ_CPU_SPARC
  154.         #define TARGET_CPU_X86                Environ_CPU_X86
  155.         #define TARGET_CPU_PPC                Environ_CPU_PPC
  156.  
  157.     
  158.     #else
  159.         /*
  160.             Rez resource compiler for MacOS from QuickTime 3.0, Apple Computer, Inc.    
  161.         */
  162.         #define TARGET_OS_MAC                1
  163.         #define TARGET_OS_WIN32                0
  164.         #define TARGET_OS_UNIX                0
  165.         #define TARGET_RT_LITTLE_ENDIAN        0
  166.         #define TARGET_RT_BIG_ENDIAN        1
  167.  
  168.         #define TARGET_CPU_MIPS                0
  169.         #define TARGET_CPU_SPARC            0
  170.         #define TARGET_CPU_X86                0
  171.         #define TARGET_CPU_PPC                1
  172.     #endif
  173.  
  174.     
  175. #else
  176.     /*
  177.         Rez resource compiler for MacOS, Apple Computer, Inc.    
  178.     */
  179.     #define TARGET_OS_MAC                1
  180.     #define TARGET_OS_WIN32                0
  181.     #define TARGET_OS_UNIX                0
  182.     #define TARGET_RT_LITTLE_ENDIAN        0
  183.     #define TARGET_RT_BIG_ENDIAN        1
  184. #endif
  185.  
  186.     
  187. #if !defined(TARGET_REZ_MAC_68K)
  188.     #define TARGET_REZ_MAC_68K        0
  189. #endif
  190. #if !defined(TARGET_REZ_MAC_PPC)
  191.     #define TARGET_REZ_MAC_PPC        0
  192. #endif
  193. #if !defined(TARGET_REZ_CARBON_CFM)
  194.     #define TARGET_REZ_CARBON_CFM    0
  195. #endif
  196. #if !defined(TARGET_REZ_CARBON_MACHO)
  197.     #define TARGET_REZ_CARBON_MACHO    0
  198. #endif
  199.  
  200.  
  201.  
  202. /****************************************************************************************************
  203.     
  204.     Set up TARGET_API_≈_≈ values
  205.  
  206. ****************************************************************************************************/
  207. /* grandfather in use of TARGET_CARBON */
  208. /* grandfather in use of TARGET_CARBON */
  209. #if TARGET_OS_MAC
  210. #if !defined(TARGET_API_MAC_OS8) && !defined(TARGET_API_MAC_OSX) && !defined(TARGET_API_MAC_CARBON)
  211. #ifdef TARGET_CARBON
  212. #if TARGET_CARBON
  213. #define TARGET_API_MAC_OS8 0
  214. #define TARGET_API_MAC_CARBON 1
  215. #define TARGET_API_MAC_OSX 0
  216. #endif
  217. #endif
  218. #endif
  219. /* No TARGET_API_MAC_* predefind on command line */
  220. #if !defined(TARGET_API_MAC_OS8) && !defined(TARGET_API_MAC_OSX) && !defined(TARGET_API_MAC_CARBON)
  221. #define TARGET_API_MAC_OS8 1
  222. #define TARGET_API_MAC_CARBON 0
  223. #define TARGET_API_MAC_OSX 0
  224. #endif
  225. #else
  226. #define TARGET_API_MAC_OS8 0
  227. #define TARGET_API_MAC_CARBON 0
  228. #define TARGET_API_MAC_OSX 0
  229. #endif
  230. /* Support source code still using TARGET_CARBON */
  231. #ifndef TARGET_CARBON
  232. #if TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8
  233. #define TARGET_CARBON 1
  234. #else
  235. #define TARGET_CARBON 0
  236. #endif
  237. #endif
  238.  
  239.  
  240. /****************************************************************************************************
  241.  
  242.     OLDROUTINENAMES            - "Old" names for Macintosh system calls are allowed in source code.
  243.                               (e.g. DisposPtr instead of DisposePtr). The names of system routine
  244.                               are now more sensitive to change because CFM binds by name.  In the 
  245.                               past, system routine names were compiled out to just an A-Trap.  
  246.                               Macros have been added that each map an old name to its new name.  
  247.                               This allows old routine names to be used in existing source files,
  248.                               but the macros only work if OLDROUTINENAMES is true.  This support
  249.                               will be removed in the near future.  Thus, all source code should 
  250.                               be changed to use the new names! You can set OLDROUTINENAMES to false
  251.                               to see if your code has any old names left in it.
  252.     
  253. ****************************************************************************************************/
  254. #ifndef OLDROUTINENAMES
  255. #define OLDROUTINENAMES 0
  256. #endif
  257.  
  258.  
  259. /****************************************************************************************************
  260.  
  261.     TARGET_CARBON                    - default: false. Switches all of the above as described.  Overrides all others
  262.                                     - NOTE: If you set TARGET_CARBON to 1, then the other switches will be setup by
  263.                                             ConditionalMacros, and should not be set manually.
  264.  
  265.     If you wish to do development for pre-Carbon Systems, you can set the following:
  266.  
  267.     OPAQUE_TOOLBOX_STRUCTS            - default: false. True for Carbon builds, hides struct fields.
  268.     OPAQUE_UPP_TYPES                - default: false. True for Carbon builds, UPP types are unique and opaque.
  269.     ACCESSOR_CALLS_ARE_FUNCTIONS    - default: false. True for Carbon builds, enables accessor functions.
  270.     CALL_NOT_IN_CARBON                 - default: true.  False for Carbon builds, hides calls not supported in Carbon.
  271.     
  272.     Specifically, if you are building a non-Carbon application (one that links against InterfaceLib)
  273.     but you wish to use some of the accessor functions, you can set ACCESSOR_CALLS_ARE_FUNCTIONS to 1
  274.     and link with PreCarbon.o, which implements just the accessor functions. This will help you preserve
  275.     source compatibility between your Carbon and non-Carbon application targets.
  276.     
  277.     MIXEDMODE_CALLS_ARE_FUNCTIONS    - deprecated.
  278.  
  279. ****************************************************************************************************/
  280. #if TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8
  281. #ifndef OPAQUE_TOOLBOX_STRUCTS
  282. #define OPAQUE_TOOLBOX_STRUCTS 1
  283. #endif
  284. #ifndef OPAQUE_UPP_TYPES
  285. #define OPAQUE_UPP_TYPES 1
  286. #endif
  287. #ifndef ACCESSOR_CALLS_ARE_FUNCTIONS
  288. #define ACCESSOR_CALLS_ARE_FUNCTIONS 1
  289. #endif
  290. #ifndef CALL_NOT_IN_CARBON
  291. #define CALL_NOT_IN_CARBON 0
  292. #endif  /* !defined(CALL_NOT_IN_CARBON) */
  293.  
  294. #ifndef MIXEDMODE_CALLS_ARE_FUNCTIONS
  295. #define MIXEDMODE_CALLS_ARE_FUNCTIONS 1
  296. #endif
  297. #else
  298. #ifndef OPAQUE_TOOLBOX_STRUCTS
  299. #define OPAQUE_TOOLBOX_STRUCTS 0
  300. #endif
  301. #ifndef OPAQUE_UPP_TYPES
  302. #define OPAQUE_UPP_TYPES 0
  303. #endif
  304. #ifndef ACCESSOR_CALLS_ARE_FUNCTIONS
  305. #define ACCESSOR_CALLS_ARE_FUNCTIONS 0
  306. #endif
  307. /*
  308.      * It's possible to have ACCESSOR_CALLS_ARE_FUNCTIONS set to true and OPAQUE_TOOLBOX_STRUCTS
  309.      * set to false, but not the other way around, so make sure the defines are not set this way.
  310.      */
  311. #ifndef CALL_NOT_IN_CARBON
  312. #define CALL_NOT_IN_CARBON 1
  313. #endif  /* !defined(CALL_NOT_IN_CARBON) */
  314.  
  315. #ifndef MIXEDMODE_CALLS_ARE_FUNCTIONS
  316. #define MIXEDMODE_CALLS_ARE_FUNCTIONS 0
  317. #endif
  318. #endif
  319.  
  320.  
  321.  
  322. #endif /* __CONDITIONALMACROS_R__ */
  323.  
  324.